//
//  SCToolBar.swift
//  weibo
//
//  Created by 阿城 on 15/12/9.
//  Copyright © 2015年 阿城. All rights reserved.
//

import UIKit

class SCToolBar: UIView {

    var statusViewModel: SCStatusViewModel?{
        didSet{
            repostsButton.setTitle(statusViewModel?.reportString, forState: UIControlState.Normal)
            commentButton.setTitle(statusViewModel?.commentString, forState: UIControlState.Normal)
            attitudeButton.setTitle(statusViewModel?.attitudeString, forState: UIControlState.Normal)
        }
    }
    
    private lazy var repostsButton = UIButton(imageName: "timeline_icon_retweet", title: "转发")
    private lazy var commentButton = UIButton(imageName: "timeline_icon_comment", title: "评论")
    private lazy var attitudeButton = UIButton(imageName: "timeline_icon_unlike", title: "赞")
    private lazy var sp1 = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
    private lazy var sp2 = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))

    private func setupUI(){
        
        addSubview(repostsButton)
        addSubview(commentButton)
        addSubview(attitudeButton)
        addSubview(sp1)
        addSubview(sp2)
        
        
        repostsButton.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(self)
            make.leading.equalTo(self)
            make.bottom.equalTo(self)
        }
        commentButton.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(self)
            make.leading.equalTo(repostsButton.snp_trailing)
            make.bottom.equalTo(self)
            make.width.equalTo(repostsButton)
        }
        attitudeButton.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(self)
            make.trailing.equalTo(self)
            make.bottom.equalTo(self)
            make.leading.equalTo(commentButton.snp_trailing)
            make.width.equalTo(commentButton)
        }
        sp1.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(repostsButton.snp_trailing)
            make.centerY.equalTo(self)
        }
        sp2.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(commentButton.snp_trailing)
            make.centerY.equalTo(self)
        }
        
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
}
